import axios from 'axios';
import config from '@/config';

function postMessage(props: {
    "conversation_id": string
    "content": string
}) {
    return axios({
        method: 'post',
        url: config.robotHost,
        data: {
            "app_key": config.app_key,
            "app_secret": config.app_secret,
            "path": "/msg/send_text",
            "data": {
                guid: config.guid,
                ...props,
                conversation_id: 'S:' + props.conversation_id
            }
        }
    }).then(response => {
        console.log('消息发送成功', response.data, props);

    }).catch(error => {
        console.log(`消息发送失败: ${error.message}`);

    });
}

export default postMessage;